#ifndef RAINBOW_TABLE_H_
#define RAINBOW_TABLE_H_

#include "DEHT.h"
#include "misc.h"
#include "generator.h"

typedef struct rtp{
	int chainLength;
	LONG_INDEX_PROJ *seedArr;
}rainbowTablePref;

typedef struct pf{
	char dictFile[80];
	int chainLength;
	int numBuckets;
	int pairs;
	char rule[80];
}params;

void initParams(params *p);

int calcSizeNeeded(rainbowTablePref *rainbowHeader, Rule *rule);

int writeRainbowDataToDEHT(DEHT *deht, rainbowTablePref *rainbowHeader, Rule *rule);

int readRainbowDataToDEHT(DEHT *deht, rainbowTablePref *rainbowHeader, Rule **rule);

LONG_INDEX_PROJ *create_seedArr(int chainLength);

int calc_down_Chain(DEHT *deht, rainbowTablePref *rt,Rule *rule, const unsigned char *start,int steps, unsigned char *outBuffer);

int query_RT(DEHT *deht, rainbowTablePref *rt,Rule *rule, unsigned char *hashIn, char *pswdBuffer);

int parseParamFile(char *filename, params *pa);

#endif /* RAINBOW_TABLE_H_ */
